C# Discord bot for .NET 8.0

Getting IIS Express to listen on a network LAN IP with visual studio.

Normally my post arnt so short but this burned 45 minutes of my time as I struggled to get a native IIS express deployment from VS2022 to use a lan port for debugging remote connections.

Navigate to \RootProjectDirectory\.vs\{ProjectName}\config\applicationhost.config

Run Visual Studio as Administrator, this is critical.
Delete the file after backing it up, then while in Visual studio click Create Virtual Directory using a different port on HTTP then the one you wish to open on lan
Start the project, then Stop debugging. Once Stopped, confirm IIS is no longer running on the taskbar.

Open the newly generated applicationhost.config file within the config directory and add the new binding, mine existed on line 168.

<binding protocol=”http” bindingInformation=”*:44392:{PUT LAN IP HERE}” />

An example of the config will look like this

<sites>
<site name=”WebSite1″ id=”1″ serverAutoStart=”true”>
<application path=”/”>
<virtualDirectory path=”/” physicalPath=”%IIS_SITES_HOME%\WebSite1″ />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”:8080:localhost” />
</bindings>
</site>
<site name=”ProjectName” id=”2″>
<application path=”/” applicationPool=”Clr4IntegratedAppPool”>
<virtualDirectory path=”/” physicalPath=”C:\Users\User\source\repos\ProjectName\ProjectName” />
</application>
<bindings>
<binding protocol=”http” bindingInformation=”*:44391:localhost” />
<binding protocol=”http” bindingInformation=”*:44392:192.168.0.199″ />
</bindings>
</site>
<siteDefaults>
<!– To enable logging, please change the below attribute “enabled” to “true” –>
<logFile logFormat=”W3C” directory=”%AppData%\Microsoft\IISExpressLogs” enabled=”false” />
<traceFailedRequestsLogging directory=”%AppData%\Microsoft” enabled=”false” maxLogFileSizeKB=”1024″ />
</siteDefaults>
<applicationDefaults applicationPool=”Clr4IntegratedAppPool” />
<virtualDirectoryDefaults allowSubDirConfig=”true” />
</sites>

Save, then click Start debug within VS. You may now HTTP from your other machine using the newly added port.

Using LLamaSharp with RAG.

So, The data appears to take 6x-7x the amount of space to archive into the SQLlite memory storage.

Clearing history with a Chatsession does not appear to work correctly so I swapped over to a stateless built which helped so long that the RAG only needs to be called once per question. If additional questions need to be asked on the same data then optimization can be added to speed things up.

I will node that the prompt I’m using to search on provided much better results then the format documented on hugging face oddly enough. “Assistant:” {Query} “User:” instead of “instruct”, “query”.

I also used a function to pull filler words to speed up and create a more reliable keyword function, but the LLM itself wasn’t too bad.

Ultimately, Ill have to stick with the statelessexecutor until I can validate that the ChatSession operates correctly. Once I call LLMSession.load(CleanSession), readding in the prompts appears to not work correctly. During debugging, upon the second add, the count of the ChatSession remained zero.