參考文件:NameResolutionFailure when using HttpClient after network connection is restored
這種情況會出現在手機斷網後又重新連上網路就會出現這樣的情況,解決方式就是在 *.Droid和 *.iOS的專案上相對應的檔案加上 ServicePointManager.DnsRefreshTimeout = 0;
2017年1月22日 星期日
2017年1月5日 星期四
Xamarin.Forms 遇到 java.lang.ClassNotFoundException: Didn't find class "android.support.graphics.drawable.VectorDrawableCompat"
參考文章:Didn't find class "android.support.graphics.drawable.VectorDrawableCompat"
目前又是開發企業分機和 MVPN查詢,只不過是換了 APP方式,我決定採用 Xamarin.Form作為我第一支 APP開發。查詢程式不難,原本在 Android 6.0模擬器上可以正常執行,很天真的以為可以直接在手機上跑了,就把程式直接放到我的手機上安裝,我的 Android版本為 5.1,開啟後一直閃退,一直閃退。隔天又拿了一支 Android 4.4的手機過來測,沒想到居然可以成功開啟並執行。 也不知道怎麼找原因,後來發現有 log可以看,最後才找到上面的錯誤字串。也花了很久才找到這篇文章,作法如下:
1. 打開專案 *.Droid 的 Nuget
2. 把 Xamarin.Forms給移除
3. 把 Xamarin.Android.Support開頭的 Library也給刪除
4. 重新安裝 Xamarin.Forms (可能會發現多個幾個 Libs是開啟在建立專案時沒有的)
5. 保險起見,把整個 VS關掉,再重新開啟後打開專案並作 clean & rebuild
完成後應該就可以解決這個問題了。
2016年12月28日 星期三
.Net Core HttpClient GetAsAsync執行時過慢問題
參考文章: HttpClient.GetAsync is slow in dnxcore50 compared to dnx461
MVC 5就用過 HttpClient,一切正常,但在開發 Line Bot時用 HttpClient呼叫已經在服務的 API時就發生斷片問題,但也不是常常發生,本來以為是我程式寫法的問題,後來追蹤時發現會一直卡在 GetAsAsync,所以上網也找到相關文章,其建議是在產生 HttpClient時先新增一個 HttpClientHandler並把其 attribute UseProxy設為 false, 這樣應該可以改善速度的問題,改寫之後果然不會再發生過慢的問題了。
MVC 5就用過 HttpClient,一切正常,但在開發 Line Bot時用 HttpClient呼叫已經在服務的 API時就發生斷片問題,但也不是常常發生,本來以為是我程式寫法的問題,後來追蹤時發現會一直卡在 GetAsAsync,所以上網也找到相關文章,其建議是在產生 HttpClient時先新增一個 HttpClientHandler並把其 attribute UseProxy設為 false, 這樣應該可以改善速度的問題,改寫之後果然不會再發生過慢的問題了。
2016年12月26日 星期一
Use Line Bot to search extensions and MVPN numbers of the enterprise
Last time I shared my first Line Bot 使用 ASP.Net Core Web API 實作 Line Bot webhook callback. It is a funny bot to show what kind of person is by entering a name. if you enter a name "Catton", it would answer "He is a handsome man."
Because of first bot, it gave me a inspiration to develop another Lin Bot that could facilitate to contact other colleagues easily. Especially for the enterprise that already has implemention of MVPN.
First of all, here is the wiki to introduce what is MVPN, Mobile virtual private network. You can dial a short number, maybe 5 or 4 digits, to communicate the colleague whose mobile phone is in your enterprise MVPN group.
Inside the enterprise, I can build a web to search someone's extension or MVPN number by entering name, employee number or department name. Here is the screenshot of web-searching.
Because of first bot, it gave me a inspiration to develop another Lin Bot that could facilitate to contact other colleagues easily. Especially for the enterprise that already has implemention of MVPN.
First of all, here is the wiki to introduce what is MVPN, Mobile virtual private network. You can dial a short number, maybe 5 or 4 digits, to communicate the colleague whose mobile phone is in your enterprise MVPN group.
Inside the enterprise, I can build a web to search someone's extension or MVPN number by entering name, employee number or department name. Here is the screenshot of web-searching.
2016年12月22日 星期四
使用 ASP.Net Core Web API 實作 Line Bot webhook callback
參考
Line 官方 Message API文件
ASP.NET Web API 實作 Line Bot 使用 Azure App Service
我是使用 Line V2 messaging API的版本和 ASP.Net Core Web API,所以在參考 ASP.NET Web API 實作 Line Bot 使用 Azure App Service,時要先參考Line 官方 Message API文件 新版 api的使用方式,還有 .Net Core改用 HttpClient實作,以下是實作結果,年底快到了,先讓自己開心一下。
其它分享:
Line Bot 分機及MVP查詢應用, 在iPhone上如何讓在 Line 訊息上可以點選簡碼撥打電話, calling link
Use Line Bot to search extensions and MVPN numbers of the enterprise
使用 ASP.Net Core Web API 開發 Line bot, messaging api可以顯示 emoji或 sticons的圖示
Line 官方 Message API文件
ASP.NET Web API 實作 Line Bot 使用 Azure App Service
我是使用 Line V2 messaging API的版本和 ASP.Net Core Web API,所以在參考 ASP.NET Web API 實作 Line Bot 使用 Azure App Service,時要先參考Line 官方 Message API文件 新版 api的使用方式,還有 .Net Core改用 HttpClient實作,以下是實作結果,年底快到了,先讓自己開心一下。
其它分享:
Line Bot 分機及MVP查詢應用, 在iPhone上如何讓在 Line 訊息上可以點選簡碼撥打電話, calling link
Use Line Bot to search extensions and MVPN numbers of the enterprise
使用 ASP.Net Core Web API 開發 Line bot, messaging api可以顯示 emoji或 sticons的圖示
2016年12月18日 星期日
使用 asp.net core實作一個類 google blog的網站
之前有分享過 試作 CKEditor 圖片選擇器 ( image upload ),利用 ckeditor和客制 image picker
來達成圖片選取,但是圖片的處理、儲存還沒實作完成,最近剛好寫完預算系統,所以利用空檔來繼續完成這個部份,完成工作內容如下:
2016年12月7日 星期三
ASP.NET Core Render View to String in Controller
參考文章:
ASP.NET Core Render View to String
Render a Razor View containing a URL to a string in ASP.NET Core
這個目的是直接在 controller直接產生 partial view的字串再回傳至 view ajax result,然後直接把某個 element換掉或作內文休改,這種方式當然也有其它的方式達成,但直接在 contorller內產生 view string也是可以試試,因為在 Asp.net MVC 5也有類似的作法或是直接使用 westwind的 library。但在 Asp.net Core就不能直接拿來用。所以參考上面的分享文章就可以達到目的了。
ASP.NET Core Render View to String
Render a Razor View containing a URL to a string in ASP.NET Core
這個目的是直接在 controller直接產生 partial view的字串再回傳至 view ajax result,然後直接把某個 element換掉或作內文休改,這種方式當然也有其它的方式達成,但直接在 contorller內產生 view string也是可以試試,因為在 Asp.net MVC 5也有類似的作法或是直接使用 westwind的 library。但在 Asp.net Core就不能直接拿來用。所以參考上面的分享文章就可以達到目的了。
訂閱:
文章 (Atom)

